﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManagementZSG.aspx.cs"
    Inherits="Golf.WebUI.AdminShow.SystemManagement.ManagementZSG" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>管理员的操作</title>
    <link href="../Style/tablelist.css" rel="stylesheet" type="text/css" />

    <script src="../../Script/ymPrompt/ymPrompt.js" type="text/javascript"></script>

    <link href="../../Script/ymPrompt/skin/bluebar/ymPrompt.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        /**********判断是否加载jquey***************/
        window.jQuery || document.write('<script src="../../Script/jquery/jquery-1.4.1-vsdoc.js" type="text/javascript"><\/script>');
    </script>

    <script type="text/javascript">
        $(function() {
            $("tbody tr:even").addClass("s_oushuhang"); //偶数行的背景色
            $("tbody tr:odd").addClass("s_jishuhang"); //奇数行的背景色
            //光棒效果
            $('tbody>tr').hover(function() {
                $(this).addClass("s_mouseover");
            }, function() {
                $(this).removeClass("s_mouseover");
            });
        });
    </script>

    <link href="../../Script/My97DatePicker/skin/whyGreen/datepicker.css" rel="stylesheet"
        type="text/css" />

    <script src="../../Script/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

    <script src="../Script/Window.js" type="text/javascript"></script>

    <script src="../../Script/jquery/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:Panel ID="Panel1" runat="server">
        <table class="table">
            <tr>
                <!--判断当前的操作-->
                <input type="hidden" value="0" runat="server" id="_action" />
                <td height="25" width="30%" align="right">
                    自增长Id ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:Label ID="lblId" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    用户名 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtAdminName" runat="server" Width="200px"></asp:TextBox>

                    <script type="text/javascript">
                        $(function() {
                            var amdinName = "<%=amdinName %>";
                            $("#ShowMsg").css("display", "none");
                            $("#txtAdminName").blur(function() {
                                var name = $("#txtAdminName").val();
                                var _action = $("#_action").val();

                                if (_action == "modify") {
                                    if (amdinName != "") {
                                        if (amdinName == name) {
                                            return false;
                                        } else {
                                            return true;
                                        }
                                    } else
                                        return false;
                                }
                                if (name != "" && name != null) {
                                    $("#ShowMsg").css("display", "block");
                                    $.ajax({
                                        type: "POST",
                                        contentType: "application/x-www-form-urlencoded",
                                        url: "../Ajax/Login_Ajax.aspx?" + Math.random(),
                                        data: {
                                            "action": "check",
                                            "name": escape(name)
                                        },
                                        success: function(msg) {
                                            if (msg == "0") {
                                                $("#ShowMsg").html('此用户名已经存在,请重新输入!');
                                            } else {
                                                $("#ShowMsg").html('此用户名可以还未被使用!');
                                            }
                                        },
                                        error: function(xhr) {
                                            alert(xhr.responseText);
                                        }
                                    });
                                } else {
                                    $("#ShowMsg").css("display", "none");
                                }
                            });
                        });
                    </script>

                    <span id="ShowMsg" style="color: #F01">
                        <img alt="" src="../load.gif" width="16" height="16" />
                        用户名正在检查中....</span>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    密码 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtPassWord" runat="server" TextMode="Password" Width="200px" Text="******"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    禁用状态 0关闭 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:CheckBox ID="chkIsState" Text="禁用状态 0关闭" runat="server" Checked="False" />
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    0不具备任何权限 Golf_A ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtGroupId" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    真实姓名 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtRealName" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    登录时间 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtLoginTime" runat="server" Width="150px" Style="background: url(../../script/My97DatePicker/skin/datePicker.gif) no-repeat right;"
                        onfocus="WdatePicker({isShowClear:true,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    最后登陆时间 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtLastLoginTime" runat="server" Width="150px" Style="background: url(../../script/My97DatePicker/skin/datePicker.gif) no-repeat right;"
                        onfocus="WdatePicker({isShowClear:true,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    登陆IP ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtLoginIP" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    最后登陆Ip ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtLastLoginIP" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    登陆次数 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtLoginNumber" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr class="is_modify">
                <td height="25" width="30%" align="right">
                    添加用户时间 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtAddTime" runat="server" Width="150px" Style="background: url(../../script/My97DatePicker/skin/datePicker.gif) no-repeat right;"
                        onfocus="WdatePicker({isShowClear:true,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tdbg" align="center" valign="bottom" colspan="2">
                    <asp:Button ID="btnSave" runat="server" Text="保存" OnClick="btnSave_Click" CssClass="btn">
                    </asp:Button>
                    <asp:Button ID="btnCancle" runat="server" Text="取消" CssClass="btn" OnClick="btnCancle_Click">
                    </asp:Button>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server" Visible="false">
        <table class="table">
            <tr>
                <!--判断当前的操作-->
                <input type="hidden" value="0" runat="server" id="Hidden1" />
                <td height="25" width="30%" align="right">
                    自增长Id ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:Label ID="lab_id" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    原密码 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txt_old" runat="server" TextMode="Password" Width="200px" Text="******"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    新密码 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtNewPwd" runat="server" TextMode="Password" Width="200px" Text="******"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">
                    确认新密码 ：
                </td>
                <td height="25" width="*" align="left">
                    <asp:TextBox ID="txtPwd1" runat="server" TextMode="Password" Width="200px" Text="******"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2">

                    <script type="text/javascript">
                        $(function() {
                            $("#btnUpdatePwd").click(function() {
                                var pwd = $("#txt_old").val();
                                var Newpwd = $("#txtNewPwd").val();
                                var Newpwd_ = $("#txtPwd1").val();
                                if (pwd == "") {
                                    alert("请输入旧密码！！！！"); return false;
                                }
                                if (Newpwd == "") {
                                    alert("请输入新密码！！！！"); return false;
                                }
                                if (Newpwd_ == "") {
                                    alert("请输入重复密码！！！！"); return false;
                                }
                                if (Newpwd != Newpwd_) {
                                    alert("两次输入密码不一致！！！！"); return false;
                                }
                                $.ajax({
                                    type: "POST",
                                    contentType: "application/x-www-form-urlencoded",
                                    url: "ManagementZSG.aspx?" + Math.random(),
                                    data: {
                                        "Action": "updatePwd",
                                        "oldPwd": pwd,
                                        "NewPwd": Newpwd,
                                        "adminid": "<%=adminId %>"
                                    },
                                    success: function(msg) {
                                        var _msg = msg.split('|')[0];
                                        alert(_msg);
                                    },
                                    error: function(xhr) {
                                        alert(xhr.responseText);
                                    }
                                });
                            });
                        });                       
                    </script>

                    <input id="btnUpdatePwd" type="button" value="  提  交  " />
                    <asp:Button ID="btnUpdatePwd_no" runat="server" Text="取消" CssClass="btn" OnClick="btnCancle_Click">
                    </asp:Button>
                </td>
            </tr>
        </table>
    </asp:Panel>
    </form>
</body>
</html>
